home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 …ember: Reference Library / Apple Developer Reference Library (December 1999) (Disk 1).iso / pc / what's new / sample code / human interface toolbox / packagetool / utilities.h < prev   
Encoding:
C/C++ Source or Header  |  1999-10-22  |  3.4 KB  |  95 lines

  1. /*
  2.     file Utilities.h
  3.     
  4.     Description:
  5.     This file contains a number of utility routines used in the
  6.     PackageTool application.  these routines have been moved here
  7.     to simplify the example.
  8.     
  9.     PackageTool is an application illustrating how to create application
  10.     packages in Mac OS 9.  It provides a simple interface for converting
  11.     correctly formatted folders into packages and vice versa.
  12.  
  13.     by John Montbriand, 1999.
  14.  
  15.     Copyright: © 1999 by Apple Computer, Inc.
  16.     all rights reserved.
  17.     
  18.     Disclaimer:
  19.     You may incorporate this sample code into your applications without
  20.     restriction, though the sample code has been provided "AS IS" and the
  21.     responsibility for its operation is 100% yours.  However, what you are
  22.     not permitted to do is to redistribute the source as "DSC Sample Code"
  23.     after having made changes. If you're going to re-distribute the source,
  24.     we require that you make it clear in the source that the code was
  25.     descended from Apple Sample Code, but that you've made changes.
  26.     
  27.     Change History (most recent first):
  28.     10/19/99 created by John Montbriand
  29. */
  30.  
  31. #ifndef __UTILITIES__
  32. #define __UTILITIES__
  33.  
  34. #include <MacTypes.h>
  35. #include <Files.h>
  36. #include <Aliases.h>
  37. #include <Drag.h>
  38. #include <Icons.h>
  39. #include <QDOffscreen.h>
  40. #include <Script.h>
  41.  
  42.  
  43. /* ValidFSSpec verifies that *spec refers is formatted correctly, and it
  44.     verifies that it refers to an existing file in an existing directory on
  45.     and existing volume. If *spec is valid, the function returns noErr,
  46.     otherwise an error is returned. */
  47. OSErr ValidFSSpec(FSSpec *spec);
  48.  
  49.  
  50. /* ResolveAliasQuietly resolves an alias using a fast search with no user interaction.  Our main loop
  51.     periodically resolves gFileAlias comparing the result to gTargetFile to keep the display up to date.
  52.     As a result, we would like the resolve alias call to be as quick as possible AND since the application
  53.     may be in the background when  it is called, we don't want any user interaction. */
  54. OSErr ResolveAliasQuietly(ConstFSSpecPtr fromFile, AliasHandle alias, FSSpec *target, Boolean *wasChanged);
  55.  
  56.  
  57. /* GrayOutBox grays out an area of the screen in the current grafport.  
  58.     *theBox is in local coordinates in the current grafport. This routine
  59.     is for direct screen drawing only.  */
  60. void GrayOutBox(Rect *theBox);
  61.  
  62.  
  63. /* ShowDragHiliteBox is called to hilite the drop box area in the
  64.     main window.  Here, we draw a 3 pixel wide border around *boxBounds.  */
  65. OSErr ShowDragHiliteBox(DragReference theDragRef, Rect *boxBounds);
  66.  
  67.  
  68. /* UpdateRelativeAliasFile updates the alias file located at
  69.      aliasDest referring to the targetFile.  relative path
  70.      information is stored in the new file. */
  71. OSErr UpdateRelativeAliasFile(FSSpec *theAliasFile, FSSpec *targetFile);
  72.  
  73. /* FileSharingAppIsRunning returns true if the file sharing
  74.     extension is running. */
  75. Boolean FileSharingAppIsRunning(void);
  76.  
  77. /* FSSpecIsInDirectory returns true if the file system object
  78.     referred to by theSpec is somewhere in the directory referred
  79.     to by (vRefNum, dirID) */
  80. Boolean FSSpecIsInDirectory(FSSpec *theSpec, short vRefNum, long dirID);
  81.  
  82.  
  83. /* FSSpecIsAFolder returns true if the FSSpec pointed
  84.     to by target refers to a folder. */
  85. Boolean FSSpecIsAFolder(FSSpec *target);
  86.  
  87.  
  88. /* ShowChangesInFinderWindow asks the finder redraw a directory
  89.     window by either sending a update container event to the
  90.     finder if this facility exists, or by bumping the parent directorie's
  91.     modification date */
  92. OSErr ShowChangesInFinderWindow(short vRefNum, long dirID);
  93.  
  94. #endif
  95.